package top.ranzhang.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
    public class MyBatisPlusConfig {
    /**
     * 配置mybatis-plus的拦截器，方便后期IPage的处理
     * Ipage会拦截你的查询语句在后面加上limit ？,？
     * @return
     */
        @Bean
        public MybatisPlusInterceptor mybatisPlusInterceptor() {
            log.info("启动mybatis-plus的拦截器。。。");
            MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
            interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
            return interceptor;
        }
    }